package com.lqq.demo11;

public class Test {
    public static void main(String[] args) {
        Master m = new Master();
        m.feed(new Cat());
        m.feed(new Dog());

        Pet p = new Dog();
        p.eat();
        if(p instanceof Dog){
            Dog d =(Dog)p;
            d.play();
        }else if(p instanceof Cat){
            Cat c = (Cat) p;
            c.catching();
        }

        Pet p1 = new Cat();
        Cat c1 = (Cat) p1;
        c1.catching();
    }
}
